package com.ecar.api.rest.manger;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

import com.ecar.api.rest.AbstractResource;
import com.ecar.api.service.manager.StaffService;
import com.ecar.common.annotation.ResponseFilter;
import com.ecar.common.dto.DataBean;
import com.ecar.common.dto.ParamBean;
import com.ecar.common.util.HttpUtils;
import com.ecar.common.util.JSONUtil;
import com.ecar.common.util.StringUtil;
import com.ecar.core.common.entity.Address;
import com.ecar.core.manager.entity.Staff;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
import java.math.BigDecimal;
import java.net.URLDecoder;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Path("/pub")
@Scope("prototype")
@Controller
public class PublicRest extends AbstractResource {
	
	@Context
	HttpServletRequest request;

	@Autowired
	StaffService staffService;
	/**
	 * 工作人员后台登录
	 * @param param
	 * @return
	 */
//	@POST
//	@Path("/staff/login")
//	@Consumes(MediaType.APPLICATION_JSON)
//	@Produces(MediaType.APPLICATION_JSON)
//	public DataBean staffLogin(JSONObject param) {
//		try {
//			String paramStr = param.getString("params");
//			if (StringUtil.isEmpty(paramStr))
//			return new DataBean(400, "登录参数错误！");
//
//			ParamBean pb = JSONUtil.deserialize(paramStr, ParamBean.class);
//			JSONObject fields = pb.getFields();
//			if (fields == null)
//				return new DataBean(400, "登录参数错误！");
//
//			String ip = HttpUtils.getRemoteHost(request);
//			//String ip ="127.0.0.1";
//			return staffService.login(fields, ip);
//		} catch (Exception e) {
//			e.printStackTrace();
//			return new DataBean(500, "登录失败，服务器错误。");
//		}
//	}

	
}
